


<!DOCTYPE html>
<html id="htmlId">
<head>
  <title>Coverage Report > StartupSystemTest</title>
  <style type="text/css">
    @import "../../css/coverage.css";
    @import "../../css/idea.min.css";
  </style>
  <script type="text/javascript" src="../../js/highlight.min.js"></script>
  <script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
</head>

<body>
<div class="content">
<div class="breadCrumbs">
Current scope:     <a href="../../index.html">all classes</a>
    <span class="separator">|</span>
    <a href="../index.html">nl.tudelft.jpacman.integration</a>
</div>

<h1>Coverage Summary for Class: StartupSystemTest (nl.tudelft.jpacman.integration)</h1>

<table class="coverageStats">
<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Class, %
</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">StartupSystemTest</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/6)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/16)
  </span>
</td>
</tr>

</table>

<br/>
<br/>


<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package nl.tudelft.jpacman.integration;
&nbsp;
&nbsp;import nl.tudelft.jpacman.Launcher;
&nbsp;import nl.tudelft.jpacman.game.Game;
&nbsp;import nl.tudelft.jpacman.level.Player;
&nbsp;
&nbsp;import org.junit.jupiter.api.AfterEach;
&nbsp;import org.junit.jupiter.api.BeforeEach;
&nbsp;import org.junit.jupiter.api.MethodOrderer;
&nbsp;import org.junit.jupiter.api.Order;
&nbsp;import org.junit.jupiter.api.Test;
&nbsp;import org.junit.jupiter.api.TestMethodOrder;
&nbsp;
&nbsp;import static org.assertj.core.api.Assertions.assertThat;
&nbsp;
&nbsp;import java.util.List;
&nbsp;
&nbsp;/**
&nbsp; * An example test class that conducts integration tests.
&nbsp; */
&nbsp;@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
<b class="nc">&nbsp;public class StartupSystemTest {</b>
&nbsp;
&nbsp;    private Launcher launcher;
&nbsp;
&nbsp;    /**
&nbsp;     * Start a launcher, which can display the user interface.
&nbsp;     */
&nbsp;    @BeforeEach
&nbsp;    public void before() {
<b class="nc">&nbsp;        launcher = new Launcher();</b>
&nbsp;    }
&nbsp;
&nbsp;    /**
&nbsp;     * Close the user interface.
&nbsp;     */
&nbsp;    @AfterEach
&nbsp;    public void after() {
<b class="nc">&nbsp;        launcher.dispose();</b>
&nbsp;    }
&nbsp;
&nbsp;    /**
&nbsp;     * The simplest test that just starts the
&nbsp;     * game and checks it is indeed in progress.
&nbsp;     * @throws InterruptedException 
&nbsp;     */
&nbsp;    @Test
&nbsp;    @Order(1)
&nbsp;    public void gameIsRunning() throws InterruptedException {
<b class="nc">&nbsp;        launcher.launch();</b>
&nbsp;
<b class="nc">&nbsp;        getGame().start();</b>
&nbsp;
<b class="nc">&nbsp;        Thread.sleep(5000L);</b>
&nbsp;        
&nbsp;        //游戏启动
&nbsp;//        assertThat(getGame().isInProgress()).isTrue();
&nbsp;        
&nbsp;        // Players
<b class="nc">&nbsp;        List&lt;Player&gt; players = getGame().getPlayers();</b>
<b class="nc">&nbsp;        assertThat(players.size()).isEqualTo(1);</b>
<b class="nc">&nbsp;        assertThat(players.get(0).getScore()).isEqualTo(0);</b>
&nbsp;        
&nbsp;    }
&nbsp;
&nbsp;    @Test
&nbsp;    @Order(2)
&nbsp;    public void gameIsPending() throws InterruptedException {
<b class="nc">&nbsp;    	launcher.launch();</b>
<b class="nc">&nbsp;    	getGame().start();</b>
&nbsp;    	
<b class="nc">&nbsp;    	Thread.sleep(5000);</b>
&nbsp;    	
&nbsp;    	//游戏启动
&nbsp;//    	assertThat(getGame().isInProgress()).isTrue();
&nbsp;    	
&nbsp;    	//暂停
<b class="nc">&nbsp;    	getGame().stop();</b>
<b class="nc">&nbsp;    	Thread.sleep(5000);</b>
&nbsp;    	
<b class="nc">&nbsp;    	assertThat(getGame().isInProgress()).isFalse();</b>
&nbsp;    	
&nbsp;    }
&nbsp;
&nbsp;    private Game getGame() {
<b class="nc">&nbsp;        return launcher.getGame();</b>
&nbsp;    }
&nbsp;}
</code>
</pre>
</div>

<script type="text/javascript">
(function() {
    var msie = false, msie9 = false;
    /*@cc_on
      msie = true;
      @if (@_jscript_version >= 9)
        msie9 = true;
      @end
    @*/

    if (!msie || msie && msie9) {
      hljs.highlightAll()
      hljs.initLineNumbersOnLoad();
    }
})();
</script>

<div class="footer">
    
    <div style="float:right;">generated on 2023-04-11 19:39</div>
</div>
</body>
</html>
